package com.example.admin.brainwave.ui.activity;

import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.admin.brainwave.R;
import com.example.admin.brainwave.base.BaseActivity;
import com.example.admin.brainwave.utils.CustomCircleProgressBar;
import com.example.admin.brainwave.utils.SPHelper;

import butterknife.BindView;

public class ResultActivity extends BaseActivity {


    @BindView(R.id.iv_top_back)
    ImageView ivTopBack;
    @BindView(R.id.tv_top_title)
    TextView tvTopTitle;
    @BindView(R.id.iv_top_login_out)
    ImageView ivTopLoginOut;
    @BindView(R.id.tv_top_right)
    TextView tvTopRight;
    @BindView(R.id.iv_top_connect)
    ImageView ivTopConnect;
    @BindView(R.id.btn_result_over)
    Button btnResultOver;
    @BindView(R.id.tv_result_num)
    TextView tvResultNum;
    @BindView(R.id.tv_result_text)
    TextView tvResultText;
    @BindView(R.id.tv_result_text1)
    TextView tvResultText1;
    @BindView(R.id.cc_result_progress)
    CustomCircleProgressBar ccResultProgress;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_result;
    }

    @Override
    protected void initView() {
        ivTopBack.setVisibility(View.GONE);
        tvTopTitle.setText(getResources().getText(R.string.brain_collection));
        ivTopConnect.setVisibility(View.VISIBLE);
        ccResultProgress.setOutsideColor(Color.parseColor("#21FBB0"));
        ccResultProgress.setProgressWidth(4);
        String num = SPHelper.getInstance(this).getString("num", "0");
        float s = Float.parseFloat(num);
        ccResultProgress.setProgress((int) (s * 100));
        tvResultNum.setText((int) (s * 100) + "%");
        tvResultText1.setText(R.string.results + (int) (s * 100) + "%");
    }

    @Override
    protected void addListener() {
        ivTopConnect.setOnClickListener(view -> startActivity(new Intent(ResultActivity.this, BluetoothActivity.class)));
        btnResultOver.setOnClickListener(view -> finish());
    }


}
